<template>
	<view>
		<view>
			<uni-search-bar class="searchBar" v-model="searchValue" :radius="15" cancelButton="none"
				@focus="enterSearch()" @input="changeGlobalData">
			</uni-search-bar>
		</view>
		<swiper class="swiper" autoplay interval=1500 circular>
			<swiper-item v-for="(item,index) in banners" :key="index">
				<image :src="item.imageUrl" mode="widthFix"></image>
			</swiper-item>
		</swiper>
		<view> Ssyz To be continue...</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				searchValue: "",
				banners: []
			}
		},
		onLoad() {
			this.getBanner()
		},
		onShow() {
			this.searchValue = getApp().globalData.searchValue
		},
		methods: {
			enterSearch() {
				uni.redirectTo({
					url: "./search"
				})
			},
			changeGlobalData() {
				getApp().globalData.searchValue = this.searchValue
			},
			async getBanner() {
				await this.$afRequest({
					url: "/banner"
				}).then(res => {
					this.banners = res.data.banners
				})
			}
		}
	}
</script>

<style lang="scss">
	.swiper {
		image {
			width: 110%;
			position: relative;
			left: -30rpx;
		}
	}
</style>
